package edu.fafu.dao.impl;

import java.util.HashSet;
import java.util.Set;

import org.springframework.stereotype.Controller;

import edu.fafu.dao.IAnswerDao;
import edu.fafu.entity.Answer;
import edu.fafu.entity.Question;
import edu.fafu.entity.User;
import edu.fafu.util.HibernateSupport;
import edu.fafu.util.PageBean;
@Controller("answerDao")
public class AnswerDao extends HibernateSupport implements IAnswerDao{
	
	
	@Override
	public void addAnswer(Answer a) {
		add(a);		
	}

	@Override
	public PageBean queryAnswerByUser(int id,PageBean pb){
		String Hql = "from Answer a inner join fetch a.questionId where a.userId="+id;
		return getList(Hql,pb);
	}

	@Override
	public void updateAnswer(Answer answer) {
		update(answer);
	}

	@Override
	public Answer queryAnswerOneById(int id) {
		String Hql="from Answer a where a.id="+id;
		return (Answer)getListOne(Hql);
	}

	
	
	
}
